
using System;
using System.Collections.Generic;
using System.Text;
using NFinal.Extension;

namespace BlackHtml5.WebSite.Models.Entity.Common
{
    public struct artile_comment:NFinal.IModel
    {
		public System.Int64 id;
		public System.Int64? channel_id;
		public System.Int64? article_id;
		public System.Int64? parent_id;
		public System.Int64? user_id;
		public System.String user_name;
		public System.String user_ip;
		public System.String content;
		public System.DateTime? add_time;
		#region Nullable
		private bool __is_null__;
        public bool __Is_Null__
        {
            get {
                return __is_null__;
            }
            set
            {
                 __is_null__=value;
            }
        }
        public static implicit operator artile_comment(string __value__)
        {
            var __value2__ = new artile_comment();
            __value2__.__Is_Null__ = __value__==null;
            return __value2__;
        }
        public static  bool operator true(artile_comment __value__)
        {
            return !__value__.__is_null__;
        }
        public static bool operator false(artile_comment __value__)
        {
            return !__value__.__is_null__;
        }
		#endregion
		#region 从get列表初始化实体类
		public static bool TryParse(NFinal.NameValueCollection get,out artile_comment par)
		{
			par=new artile_comment();
			try
			{
						System.Int64.TryParse(get["id"],out par.id);
						par.channel_id=null;
						if(get["channel_id"]!=null)
						{
							par.channel_id=get["channel_id"].AsVar();
						}
						par.article_id=null;
						if(get["article_id"]!=null)
						{
							par.article_id=get["article_id"].AsVar();
						}
						par.parent_id=null;
						if(get["parent_id"]!=null)
						{
							par.parent_id=get["parent_id"].AsVar();
						}
						par.user_id=null;
						if(get["user_id"]!=null)
						{
							par.user_id=get["user_id"].AsVar();
						}
						par.user_name=get["user_name"];
						par.user_ip=get["user_ip"];
						par.content=get["content"];
						par.add_time=null;
						if(get["add_time"]!=null)
						{
							par.add_time=get["add_time"].AsVar();
						}
			}
			catch
			{
				return false;
			}
			return true;
		}
		#endregion
		#region 写Json字符串
		public void WriteJson(System.IO.TextWriter tw)
		{
			tw.Write("{");
					tw.Write("\"id\":");
					tw.Write(id.ToString());
					tw.Write(",");
					tw.Write("\"channel_id\":");
					tw.Write(channel_id==null?"null" : channel_id.ToString());
					tw.Write(",");
					tw.Write("\"article_id\":");
					tw.Write(article_id==null?"null" : article_id.ToString());
					tw.Write(",");
					tw.Write("\"parent_id\":");
					tw.Write(parent_id==null?"null" : parent_id.ToString());
					tw.Write(",");
					tw.Write("\"user_id\":");
					tw.Write(user_id==null?"null" : user_id.ToString());
					tw.Write(",");
					tw.Write("\"user_name\":");
					tw.Write("\"");
					tw.Write(user_name==null?"null":user_name);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"user_ip\":");
					tw.Write("\"");
					tw.Write(user_ip==null?"null":user_ip);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"content\":");
					tw.Write("\"");
					tw.Write(content==null?"null":content);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"add_time\":");
					tw.Write("\"");
					tw.Write(add_time==null?"null":add_time.ToString());
					tw.Write("\"");

			tw.Write("}");
		}
		#endregion
    }
}
